/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$(function() {
//serverNode();
socketio();
});
function socketio() {
    var socket = io();
    $(function() {
        $('form').submit(function() {
            socket.emit('chat', $('#m').val());
            $('#m').val('');
            return false;
        });
        socket.on('chat', function(msg) {
            $('#messages').append($('<li>').text(msg));
        });
    });
}
function serverNode()
{
// create object
    var socket = new YiiNodeSocket();

// enable debug mode
    socket.debug(true);

    socket.onConnect(function() {
        // fire when connection established
    });

    socket.onDisconnect(function() {
        // fire when connection close or lost
    });

    socket.onConnecting(function() {
        // fire when the socket is attempting to connect with the server
    });

    socket.onReconnect(function() {
        // fire when successfully reconnected to the server
    });
}
